/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.annuaireComp.facades;

import fr.annuaireComp.entities.Personnel;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author MiniK
 */
@Stateless
public class PersonnelFacade extends AbstractFacade<Personnel> implements PersonnelFacadeLocal, PersonnelFacadeRemote {
    @PersistenceContext(unitName = "annuaireCompEJBPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public PersonnelFacade() {
        super(Personnel.class);
    }

    @Override
    public List<Personnel> findByEmail(String email) {
       Query q = em.createNamedQuery("personnel.findByEmail",Personnel.class);
        q.setParameter("email", email);
       return q.getResultList(); //TODO peut lancer NoResultException voir si sa pose pb

    }
    
    
    
}
